package com.baizhi.service.impl;

import com.baizhi.dao.ResourceDAO;
import com.baizhi.entity.Resource;
import com.baizhi.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Service
public class ResourceServiceImpl implements ResourceService {

    @Autowired
    private ResourceDAO resourceDAO;

    @Override
    public Set<String> showByName(String username) {
        List<Resource> resources = resourceDAO.selectByName(username);
        HashSet<String> set = new HashSet<>();
        for (Resource resource:resources){
            set.add(resource.getResourcePermission());
        }

        return set;
    }
}
